package com.atguigu.realtime.gmallpublisher.util;

import io.searchbox.client.JestClient;
import io.searchbox.client.JestClientFactory;
import io.searchbox.client.config.HttpClientConfig;

/**
 * @Author lzc
 * @Date 2020/11/14 10:10
 */
public class MyEsUtil {
    private static JestClientFactory factory;

    static {
        factory = new JestClientFactory();
        HttpClientConfig config = new HttpClientConfig.Builder("http://hadoop162:9200")
                .connTimeout(1000 * 10)
                .readTimeout(1000 * 10)
                .maxTotalConnection(100)
                .multiThreaded(true)
                .build();
        factory.setHttpClientConfig(config);
    }

    public static JestClient getClient() {
        return factory.getObject();
    }

}
